package com.planet.stockanalysis.server.main;

import java.net.URL;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;

public class TestGrab {
	static final String[] FIELDS = new String[]{
		"股票代号","股票名称","行情时间","最新价（元）",
		"昨收盘（元）","今开盘（元）","涨跌额（元）","最低（元）",
		"最高（元）","涨跌幅（%）","成交量（手）","成交额（万元）",
		"竞买价（元）","竞卖价（元）","委比（%）",
		"买一","买二","买三","买四","买五",
		"卖一","卖二","卖三","卖四","卖五",
	};
	public static void main(String[] args){
		
		/**
		 深沪A股 导入规则：
		 1、2、3、4位数是sz
		 6位数300开头的是sz
		 6位数600开头的是sh
		所有指数导入规则：
			6位数395、399开头的是sz
			1、2、3、位数是sh
			6位数88888开头的是sh
		 */
		
		
		try {
			URL url = new URL("http://www.webxml.com.cn/WebServices/ChinaStockWebService.asmx/getStockInfoByCode?theStockCode=sh000001");
			Document d = Jsoup.parse(url,10000);
			Elements elements = d.getElementsByTag("string");
			for(int i=0; i<elements.size(); i++){
				System.out.println(FIELDS[i]+":"+elements.get(i).text());
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}